gdkwindow-wayland: Destroy the xdg roles before the wl_surface
authorJasper St. Pierre <jstpierre@mecheye.net>
Thu, 19 Jun 2014 19:10:01 +0000 (15:10 -0400)
committerJasper St. Pierre <jstpierre@mecheye.net>
Thu, 19 Jun 2014 19:10:54 +0000 (15:10 -0400)
Since the xdg roles are a special case of the surface, some compositors
like Weston destroy them automatically when the wl_surface is destroyed.
Thus, we need to destroy these first.

gdk/wayland/gdkwindow-wayland.c

index b8d341efc27fae674aef752c9bb5f9a69857cd06..036700972c2cc4a372822436d2c8788a731f2aac 100644 (file)
@@ -1075,6 +1075,17 @@ gdk_wayland_window_hide_surface (GdkWindow *window,
 
   if (impl->surface)
     {
+      if (impl->xdg_surface)
+        {
+          xdg_surface_destroy (impl->xdg_surface);
+          impl->xdg_surface = NULL;
+        }
+      else if (impl->xdg_popup)
+        {
+          xdg_popup_destroy (impl->xdg_popup);
+          impl->xdg_popup = NULL;
+        }
+
       if (!is_destroy)
         {
           wl_surface_attach (impl->surface, NULL, 0, 0);
@@ -1088,17 +1099,6 @@ gdk_wayland_window_hide_surface (GdkWindow *window,
           g_slist_free (impl->outputs);
           impl->outputs = NULL;
         }
-
-      if (impl->xdg_surface)
-        {
-          xdg_surface_destroy (impl->xdg_surface);
-          impl->xdg_surface = NULL;
-        }
-      else if (impl->xdg_popup)
-        {
-          xdg_popup_destroy (impl->xdg_popup);
-          impl->xdg_popup = NULL;
-        }
     }
 
   impl->mapped = FALSE;